//user.js
import { SET_USERINFO } from "@/types/mutation-types";
window.console.log(SET_USERINFO);
const state = {
    name: "",
    age: "",
    nickName: "",
    ageIternet: "",
};
const mutations = {
    [SET_USERINFO]: function (state, payload) {
        const { name, age, nickName, ageIternet } = payload;
        //使用结构赋值简化代码
        state.name = name;
        state.age = age;
        state.nickName = nickName;
        state.ageIternet = ageIternet;
    },
};

const actions = {
    [SET_USERINFO]: function ({ commit }, payload) {
        commit(SET_USERINFO, {
            //以载荷形式提交
            name: payload.name,
            age: payload.age,
            nickName: payload.nickName,
            ageIternet: payload.ageIternet,
        });
    },
};
export default {
    namespaced: true,
    state,
    mutations,
    actions,
};


